package com.xlp;

import java.io.IOException;
import java.lang.reflect.Array;
import java.net.URL;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Enumeration;

public class Test {
    public static void main(String[] args) throws Exception {
        System.out.println((String[]) null);

        A a = new A();
        B b = new B();
        b.setA(a);
        a.setB(b);
        System.out.println(a);
        System.out.println(b);
        System.out.println(Test.class.getClassLoader().getClass().getClassLoader());

        ClassLoader contextClassLoader = Thread.currentThread().getContextClassLoader();
        System.out.println(contextClassLoader);
        Enumeration<URL> resources = contextClassLoader.getResources("*/xlp");
        while (resources.hasMoreElements()){
            System.out.println(resources.nextElement());
        }

        System.out.println(Array.newInstance(String[].class, 1).getClass().getName());
        System.out.println(Array.newInstance(Integer[].class, 1).getClass().getName());
        System.out.println(Array.newInstance(int[].class, 1).getClass().getName());
        System.out.println(Array.newInstance(double[].class, 1).getClass().getName());
        System.out.println(Class.forName(char[].class.getName()));
        char[][] c = (char[][]) Array.newInstance(Class.forName(char[].class.getName()), 1);
        c[0] = new char[]{'1','2'};
        System.out.println(Arrays.deepToString(c));

        System.out.println(Arrays.toString(String.class.getDeclaredConstructors()));

        StackTraceElement[] stackTrace = new RuntimeException().getStackTrace();

        for (StackTraceElement stackTraceElement : stackTrace) {
            System.out.println(stackTraceElement);
            System.out.println(stackTraceElement.getMethodName() + "--" + stackTraceElement.getClassName());
        }
    }
}
